<template>
  <div class="UPpassStyleBox">
      <div class="UPpassStyleRgba">
          <img src="https://gimg2.baidu.com/image_search/src=http%3A%2F%2Finews.gtimg.com%2Fnewsapp_bt%2F0%2F11533735478%2F1000.jpg&refer=http%3A%2F%2Finews.gtimg.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1648728497&t=68b9ca8a22efaa8cddef606dfc91caf1" alt="">
      </div>
      <div class="UpPassTitleFrom">
          <p><span class="UpPassName">原密码:&nbsp;&nbsp;</span><input class="UpPassIpt" type="password" v-model="forFrom.phone" placeholder="请你输入原密码"></p>
          <p><span class="UpPassName">修改密码:</span><input class="UpPassIptS" type="password" v-model="forFrom.password" placeholder="请你输入新密码"></p>
          <p><span class="UpPassName">验证码:</span><input class="UpPassCode" type="text" placeholder="输入验证码"><span class="UpAssCode" @click="UoPassCodeFunc"  v-html="text"></span></p>
          <p class="PassCode"><button class="YesAddBtn" @click="info" >确定</button><button @click="ReturnBtn" class="ReturnBtn">返回</button></p>
      </div>
  </div>
</template>

<script>
import Axios from 'axios';
import { message } from 'ant-design-vue';
export default {
   data() {
       return {
           text:"",
           forFrom:{
          phone:"",//原密码
          password:"",//修改密码
        }
       }
   },
   created() {
       this.UoPassCodeFunc();//验证码函数
   },
   methods: {
       //验证码
      async UoPassCodeFunc(){
          let res = await Axios.get("/api/getCode");
          this.text = res.data.data
      },
      //确定按钮
      async info(){
         let res = await Axios.post('/api/login',{...this.forFrom})
         window.localStorage.setItem("token",res.data.token);
         message.info('修改成功');
          this.$router.push("/login")

      },
      //没有按钮
      ReturnBtn(){
          this.$router.push("/login")
          
      }
   },
   components:{

   }
}
</script>

<style>
*{
    margin: 0;
    padding: 0;
    list-style: none;
    box-sizing: border-box;
}
html,body{
    width: 100%;
    height: 100%;
}
.UPpassStyleBox{
     width: 100%;
    height: 100%;
}
.UPpassStyleRgba{
    width: 1200px;
    height: auto;
    margin: 50px auto;
}
.UpPassTitleFrom{
    width: 300px;
    height: 400px;
    top: 130px;
    left: 300px;
    border-radius: 20px;
    position: absolute;
    background: rgba(255,255,255,.5);
}
.UpPassTitleFrom>p{
    margin-top: 50px;
}
.UpPassIpt{
    width: 220px;
    height: 30px;
    padding: 5px;
}
.UpPassIptS{
    width: 210px;
    height: 30px;
    padding: 5px;
}
.UpPassName{
    font-size: 20px;
}
.PassCode{
    display: flex;
}
.UpPassCode{
    width: 100px;
    height: 30px;
    padding: 5px;

}
.YesAddBtn{
    width: 120px;
    height: 35px;
    margin-left: 15px;
    border-radius: 10px;
    color: red;
    font-weight: bold;
    outline: none;
    background: skyblue;
}
.ReturnBtn{
     width: 120px;
    height: 35px;
    margin-left: 17px;
    border-radius: 10px;
    color: red;
    font-weight: bold;
    outline: none;
    background: skyblue;
}
.UpAssCode{
    width: 100px;
    height: 35px;
    display: inline-block ;
    background: #fff;
}
</style>